package string;

/**
 * String支持正则表达式方法三:
 * String replaceAll(String regex,String replacement)
 * 替换所有匹配正则表达式的子串
 */
public class ReplaceAllDemo {
    public static void main(String[] args) {
        String line = "abc123def456ghi";
        //将数字部分替换为单词"NUMBER"
        String result = line.replaceAll("[0-9]+","NUMBER");
        System.out.println(result);
    }
}
